// SPDX-FileCopyrightText: Adam Evyčędo
//
// SPDX-License-Identifier: GPL-3.0-or-later

package xyz.apiote.bimba.czwek.repo

import android.content.Context
import android.graphics.drawable.Drawable
import android.net.ConnectivityManager
import xyz.apiote.bimba.czwek.api.Server

interface Queryable
interface Locatable {
	fun icon(context: Context, scale: Float = 1f): Drawable
	fun location(): Position
	fun id(): String
}

interface Repository {
	suspend fun getFeeds(
		context: Context,
		server: Server = Server.get(context)
	): Map<String, FeedInfo>?

	suspend fun getDepartures(
		feedID: String,
		stop: String,
		line: String?,
		context: Context,
		limit: Int?
	): StopDepartures?

	suspend fun getLocatablesIn(
		cm: ConnectivityManager,
		bl: Position,
		tr: Position,
		context: Context
	): List<Locatable>?

	suspend fun getLine(
		cm: ConnectivityManager,
		feedID: String,
		line: String,
		context: Context
	): Line?

	suspend fun queryQueryables(
		query: String,
		context: Context
	): List<Queryable>?

	suspend fun locateQueryables(
		position: Position,
		context: Context
	): List<Queryable>?
}